package com.hui10.mediaplayer.presenter

import com.hui10.mediaplayer.base.BasePresenter
import com.hui10.mediaplayer.base.BaseView
import com.hui10.mediaplayer.model.HomeItemBean
import com.hui10.mediaplayer.net.ResponseHandler
import com.hui10.mediaplayer.net.request.HomeRequest
import com.hui10.mediaplayer.view.HomeView

/**
 * Author: Created by lucus on 2019/5/29.
 * E-mail: mcphilex1989@gmail.com
 * Tel: 15652608401
 */
class HomePresenter(var homeView: BaseView<List<HomeItemBean>>?) : BasePresenter<List<HomeItemBean>>(homeView),
    ResponseHandler<List<HomeItemBean>> {

    override fun onError(type: Int, msg: String?) {
        homeView?.onError(type, msg)
    }

    override fun onSuccess(type: Int, result: List<HomeItemBean>?) {
        homeView?.onSuccess(type, result)
    }

    override fun loadData(type: Int) {
        HomeRequest(type, 0, this).excute()
    }

    override fun loadMoreData(type: Int, offset: Int) {
        HomeRequest(type, offset, this).excute()
    }
}